package com.kust.smarthome.web.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kust.smarthome.web.dto.CommodityDto;
import com.kust.smarthome.web.model.Collection;
import com.kust.smarthome.web.model.Commodity;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CollectionMapper extends BaseMapper<Collection> {

    @Select("select commodity.id as commodityId,name,intro,money,view_count,imgurl1,type from commodity left join collection on commodity.id=collection.commodity_id where user_id=#{userId}")
    List<CommodityDto> findList(Integer userId);

}
